package chap6;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class ValidateInput {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
//        String user="laoliu";
//        String pass="laoliu123";
        for (int cishu=1;cishu<=3;cishu++){
            System.out.println("请输入用户名：");
            String a1=in.next();
            System.out.println("请输入密码：");
            String a2=in.next();
            if ("zhao".equals(a1)&&"12345".equals(a2)){
                System.out.println("成功登录。");
                break;
            }else {
                System.out.println("输入错误，您还有"+(3-cishu)+"次数");
                if(cishu==3){
                    System.out.println("对不起，您3次均输入错误。");
                }

            }
        }
    }
}
